
from tools.grpc import grpcFunc
from tools.utils import SetTimeOutFunc
from tools import log, ResResponse, EnumStaCode, EnumErrCode
from views.face import runBaseImg, refreshFaceDataFunc



@grpcFunc("Check") # 人脸检测
def Check(params: dict, *args, **kwargs) -> ResResponse:
    if "baseimg" in params:
        results = runBaseImg(params["baseimg"])
        return ResResponse(
            data=results
        )
    return ResResponse(
        stacode=EnumStaCode.ERROR,
        errcode=EnumErrCode.PARAMS_EXCEPTION,
        message="参数异常",
    )

@grpcFunc("refreshFaceData") # 刷新人脸数据
def refreshFaceData(params: dict, *args, **kwargs) -> ResResponse:
    SetTimeOutFunc(refreshFaceDataFunc)
    return ResResponse()


